<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="format-detection" content="telephone=no" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<script type="text/javascript" src="static/admin/js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="static/admin/js/rem.js"></script>
	<link rel="stylesheet" href="static/admin/css/index.css" />
	<link rel="stylesheet" href="static/admin/css/icon/iconfont.css" />
	<title>停车缴费</title>
</head>

<body>
	<div class="white">
		<div class="header">
			<img src="parkinglogo/{$propertyinfo.merchant_logo}" alt="">
			<span>{$orderidinfo.parking_name}</span>
			<!-- <span>早早科技停车场</span> -->
		</div>
		<div class="much">
			{$orderidinfo.pay_money} 元
		</div>
		<p style="font-size:18px; text-align: center;line-height: 30px;">待付款</p>
		<div class="content">
			<div class="c-top">
			</div>
			<div class="c-bottom">
				<ul class="t-name">
					<li>应付金额</li>
					<li>已付金额</li>
					<li>优惠金额</li>
					<li>车牌号码</li>
					<li>入场时间</li>
					<li>停车时长</li>
				</ul>
				<ul class="t-much">
					<li>{$orderidinfo.pay_money} 元</li>
					<li>0.00 元</li>
					<li>0.00 元</li>
					<li>{$orderidinfo.car_number}</li>
					<li>{$orderidinfo.in_time|date="Y-m-d H:i:s",###}</li>
					<li>{$orderidinfo.in_duration}</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="footer">
		<p><i class="iconfont layui-extend-gantanhao"></i>请于付款后15分钟内离场，超时将加收停车费</p>
		<a onclick="order('{$orderidinfo.id}')" href="javascript:;"><button>立即付款</button></a>
	</div>
	<!-- <div class="copyright">
		<p>本服务由{$propertyinfo.merchant_name}提供</p>
		<p>本服务由早早科技提供</p>
		<p>客服电话<a href="javascript:;">{$propertyinfo.merchant_service_phone}</a></p>
	</div> -->
	<script type="application/javascript">
		function order(id){
			var url = '{:url("noCarPayWx")}'
			$.post(url, {id: id}, function(r){
				//console.log(r)
				//return
				if (r.jsApiParameters) {
					jsApiCall(r.jsApiParameters)
				}else{
					alert(r.info)
					location.reload()
					// window.location.href="{:url('admin/Order/orderindex')}";
				}
			})
		}

		function jsApiCall(jsApiParameters){
			var jsApiParameters = eval('(' + jsApiParameters + ')');
			// console.log(jsApiParameters);
			WeixinJSBridge.invoke(
					'getBrandWCPayRequest',{
					"appId":jsApiParameters['appId'],//公众号名称，由商户传入
					"timeStamp":jsApiParameters['timeStamp'],//时间戳，自1970年以来的秒数
					"nonceStr":jsApiParameters['nonceStr'], //随机串
					"package":jsApiParameters['package'],//预支付交易会话标识
					"signType":jsApiParameters['signType'],//微信签名方式：
					"paySign":jsApiParameters['paySign']//微信签名
				},
				//上面参数一定要按照一定的顺序排列，否则会出错（签名验证失败）
				function(res) {
					//前端接收到支付结果通知，get_brand_wcpay_request:ok，支付成功
					//（但是不一定就是真的成功了，一切以回调地址中的结果为准，前端接收到支付通知后只做跳转，不做任何处理）
					//商户订单处理（更新用户账号余额）要放在回调地址中处理
					if(res.err_msg == "get_brand_wcpay_request:ok" ){
						//支付成功，跳转到其他页面
						location.href="{:url('admin/Order/wxok')}";
					}
				}
			);
		}
		if (typeof WeixinJSBridge == "undefined"){
			if( document.addEventListener ){
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
			}else if (document.attachEvent){
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		}else{
			onBridgeReady();
		}
	</script>
	
</body>

</html>